
import Vue from 'vue'
import Vuex from 'vuex'
import cart from './modules/cart'  //举例
import auth from './modules/auth';
import {clearStorage} from '@/utils/index'

//import products from './modules/products'
//import createLogger from '../../../src/plugins/logger'

Vue.use(Vuex)

//*不要在发布环境下启用严格模式！ 会造成性能损失
//const debug = process.env.NODE_ENV !== 'production'


//公共数据
const state = {
  loading: false,
  menus:[],
  overviewActive:0,
}
//同步加载数据
const mutations = {
      changeOverViewActive(state,status){
        state.overviewActive = status;
      },
      changeResourcesActive(state,status){
        state.ResourcesActive = status;
      },
  /*changeLogin(state,status){
    state.isLogin = status;
  }*/
}
//实现异步加载数据
const actions = {
    FedLogOut({commit}){
      clearStorage('showAllFunction');
      sessionStorage.clear();
    }
}


export default new Vuex.Store({
  state,
  actions,
  mutations,
  modules: {
    cart,  //举例
    auth
  }
})
//  plugins: debug ? [createLogger()] : []


